﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using GymTimer.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GymTimer.PageModels
{
    public partial class ExerciseDetailPageModel:ObservableObject
    {
        private TimerDataBase _timerData;

        public ExerciseDetailPageModel(TimerDataBase timerData)
        {
            _timerData = timerData;
        }


        [ObservableProperty]

        private TimeSpan _ExerciseTime=TimeSpan.FromSeconds(30);


        [ObservableProperty]

        private TimeSpan _ResetTime;


        [RelayCommand]


        private async Task Save()
        {

            Exercise exercise = new Exercise();

            exercise.ExerciseTime = ExerciseTime.Seconds;

            await _timerData.SaveExercise(exercise);

        }



    }
}
